package com.wendy.admin.service.impl;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.wendy.admin.domain.bo.SysLogininforBo;
import com.wendy.admin.domain.vo.SysLogininforVo;
import com.wendy.admin.entity.SysLogininfor;
import com.wendy.admin.mapper.SysLogininforMapper;
import com.wendy.admin.service.ISysLogininforService;
import com.wendy.common.core.domain.TableDataInfo;
import com.wendy.common.dao.mybatis.mapper.BasePlusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 系统访问日志情况信息 服务层处理
 *
 * @author wendy
 */
@Service
public class SysLogininforServiceImpl extends
        BasePlusService <SysLogininforMapper, SysLogininfor, SysLogininforVo>
        implements ISysLogininforService {

    @Autowired
    private SysLogininforMapper logininforMapper;

    /**
     * 新增系统登录日志
     *
     * @param logininfor 访问日志对象
     */
    @Override
    public int insertLogininfor(SysLogininfor logininfor) {
        return logininforMapper.insertLogininfor(logininfor);
    }

    /**
     * 查询系统登录日志集合
     *
     * @param logininfor 访问日志对象
     * @return 登录记录集合
     */
    @Override
    public List<SysLogininfor> selectLogininforList(SysLogininforBo logininfor) {
        return logininforMapper.selectLogininforList(logininfor);
    }

    /**
     * 批量删除系统登录日志
     *
     * @param infoIds 需要删除的登录日志ID
     * @return 结果
     */
    @Override
    public int deleteLogininforByIds(Long[] infoIds) {
        return logininforMapper.deleteLogininforByIds(infoIds);
    }

    /**
     * 清空系统登录日志
     */
    @Override
    public void cleanLogininfor() {
        logininforMapper.cleanLogininfor();
    }

    @Override
    public TableDataInfo<SysLogininforVo> selectLogininforPage(SysLogininforBo logininfor) {
        Page<SysLogininfor> result = logininforMapper.selectLogininforList(getEntityPage(), logininfor);
        TableDataInfo<SysLogininforVo> tbResult = exchangeTableInfoVoPage(result);
        return tbResult;
    }
}
